package es

import "github.com/olivere/elastic/v7/config"

type Config struct {
	URL         string `json:"url" yaml:"url"`
	Index       string `json:"index" yaml:"index"`
	Username    string `json:"username" yaml:"username"`
	Password    string `json:"password" yaml:"password"`
	Shards      int    `json:"shards" yaml:"shards"`
	Replicas    int    `json:"replicas" yaml:"replicas"`
	Sniff       bool   `json:"sniff" yaml:"sniff"`
	Healthcheck bool   `json:"healthcheck" yaml:"healthcheck"`
	Infolog     string `json:"infolog" yaml:"infolog"`
	Errorlog    string `json:"errorlog" yaml:"errorlog"`
	Tracelog    string `json:"tracelog" yaml:"tracelog"`
}

func (c Config) esConf() *config.Config {
	return &config.Config{
		URL:         c.URL,
		Index:       c.Index,
		Username:    c.Username,
		Password:    c.Password,
		Shards:      c.Shards,
		Replicas:    c.Replicas,
		Sniff:       &c.Sniff,
		Healthcheck: &c.Healthcheck,
		Infolog:     c.Infolog,
		Errorlog:    c.Errorlog,
		Tracelog:    c.Tracelog,
	}
}
